
#include "south.h"
#include <osgViewer/ViewerEventHandlers>
#include <osgDB/ReadFile>  
#include <osgGA/FirstPersonManipulator>
#include <osgGA/DriveManipulator>
#include <osgGA/KeySwitchMatrixManipulator>
#include <osgGA/TrackballManipulator>
#include <osgGA/GUIEventAdapter>
#include <osg/MatrixTransform> 

int main()
{
	osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer;
	osg::ref_ptr < osg::MatrixTransform> mat = new osg::MatrixTransform;
	double angle = 0;
	angle = osg::DegreesToRadians(90.f);
	mat->setMatrix(osg::Matrix::rotate(angle, 0, 1, 0));
	std::string modelFile = "F:/Other/3d/161013.ive";
	modelFile = "F:/Other/model/20160908.ive";
	mat->addChild(osgDB::readNodeFile(modelFile));
	viewer->setSceneData(mat);
	//viewer->addEventHandler(new osgViewer::StatsHandler);
	auto cm = osgGA::KeySwitchMatrixManipulator();
	cm.addMatrixManipulator(osgGA::GUIEventAdapter::KEY_0, "Manual", new South());
	cm.addMatrixManipulator(osgGA::GUIEventAdapter::KEY_1, "Trall", new osgGA::TrackballManipulator());
	viewer->setCameraManipulator(&cm);

	return viewer->run();
}